<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //通过dom获得操作元素
        window.onload=function(){
            var d=document.getElementById("d1")
                d.onclick=function(){
                    d.style.backgroundColor="red"
        }
            var btn=document.getElementById("btn1")
        //绑定一个事件
                btn.onclick=function(){
                    alert("单击了")
                    d.onclick()
        }

        


    }
    </script>
    <style>
        .div1{
            width:100px;
            height: 100px;
            background-color: yellow;
        }
    </style>
</head>


<body><!-- onload="ready()" -->
    <div id="d1" class="div1">

    </div>
    <button id="btn1">按钮</button>
    <a href="13BOM编程常见api.html">13页</a>
</body>
</html>